package cn.uway.service;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cn.uway.utils.PubValue;


/**
 * service层基础类
 * @author yiranli
 * @version 1.0
 * @since 2016.2.8
 *
 */
public class BaseService {
	
	protected Logger log = LoggerFactory.getLogger(this.getClass());
	
	public Map<String, Object> successRsltMap(String msg, Object objData){
		Map<String, Object> rslt = new HashMap<String, Object>();
		rslt.put(PubValue.RET_CODE_KEY, PubValue.RET_CODE_SUCCESS);
		rslt.put(PubValue.RET_MSG_KEY, msg);
		if( objData != null ) {
			rslt.put(PubValue.RET_DATA_KEY, objData);
		}
		return rslt;
	}
	
	public Map<String, Object> failRsltMap(String msg){
		Map<String, Object> rslt = new HashMap<String, Object>();
		rslt.put(PubValue.RET_CODE_KEY, PubValue.RET_CODE_FAILED);
		rslt.put(PubValue.RET_MSG_KEY, msg);
		return rslt;
	}

}
